package com.sky.Task;

import com.sky.mapper.OrderMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;


@Component
@Slf4j
//定时任务执行类
public class OrderTask {

    @Autowired
    private OrderMapper orderMapper;
    //每天凌晨1点执行一次
    @Scheduled(cron = "0 0 1 * * ?")
    public void againTimeOutOrder(){
        log.info("定时处理超时订单 时间 :{} " , LocalDateTime.now());
        orderMapper.updateStatusOnDdl();
    }
}
